import axios from "@/api/http";
import qs from 'qs'

const view = (params: any = {}) => {
    return axios.post('/folder/view', params)
}
const search = (params: any = {}) => {
    return axios.post('/folder/search', params)
}

const newFolder = (params: any = {}) => {
    return axios.post('/folder/newFolder', params)
}
const remove = (params: any = {}) => {
    return axios.post('/folder/remove', qs.stringify(params))
}

const rename = (params: any = {}) => {
    return axios.post('/folder/rename', params)
}

const download =  (params: any = {}) => {
    return axios({
        method: 'get',
        url: '/folder/download',
        params: params,
        responseType: 'blob'
    })
}

export default {
    view,
    search,
    newFolder,
    remove,
    rename,
    download
}